package com.suli.multimedia.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suli.multimedia.entity.Note;
import com.suli.multimedia.mapper.NoteMapper;
import com.suli.multimedia.service.NoteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author SuLi
 * @since 2022-04-26
 */
@Service
@Transactional
public class NoteServiceImpl extends ServiceImpl<NoteMapper, Note> implements NoteService {

    @Autowired
    NoteMapper  noteMapper;

    @Override
    public Map<String, Object> getNoteList(Long page, Long limit) {
        Page<Note> page1=new Page<>(page,limit);
        Page<Note> notePage = noteMapper.selectPage(page1,null);
        Map<String, Object> map=new HashMap<>();
        map.put("total", notePage.getTotal());
        map.put("noteList", notePage.getRecords());
        return map;
    }
}
